package com.game.worm.mobile.view.discovery;

import android.os.Bundle;
import android.view.View;

import com.dx.as.fragment.TFragment;
import com.game.worm.mobile.R;
import com.game.worm.mobile.view.discovery.group.ArticleActivity;
import com.game.worm.mobile.view.discovery.newstart.NewStartActivity;
import com.game.worm.mobile.view.discovery.tools.ToolsActivity;

/**
 * Created by d_xxiang on 2018/3/27.
 */

public class DiscoveryFragment extends TFragment{
    @Override
    public void initView() {
        findView(R.id.crack).setOnClickListener(onClickListener);
        findView(R.id.tools).setOnClickListener(onClickListener);
        findView(R.id.feedback).setOnClickListener(onClickListener);
        findView(R.id.new_start).setOnClickListener(onClickListener);
        findView(R.id.group).setOnClickListener(onClickListener);
        hideToolbar(false);
    }

    @Override
    public int setLayoutI() {
        return R.layout.fragment_discovery;
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        if (!hidden){
            hideToolbar(false);
        }
    }

    @Override
    public void dataOpion() {

    }

    @Override
    public void initRpo() {

    }


    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Bundle bundle = new Bundle();
            switch (v.getId()){
                case R.id.group:
                    bundle.putInt(ArticleActivity.Article_Type,ArticleActivity.Article_User);
                    goToNewActivity(ArticleActivity.class,bundle);
                    break;
                case R.id.new_start:
                    goToNewActivity(NewStartActivity.class);
                    break;
                case R.id.tools:
                    goToNewActivity(ToolsActivity.class);
                    break;
                case R.id.crack:
                    break;
                case R.id.feedback:
                    bundle.putInt(ArticleActivity.Article_Type,ArticleActivity.Article_Official);
                    goToNewActivity(ArticleActivity.class,bundle);
                    break;
            }
        }
    };
}
